<template>
	<view>
		<view class="top-box">
			<image class="top-bg" src="https://syxiyi.oss-cn-shenzhen.aliyuncs.com/frontend/img/yydetail-bg.png"></image>
			<view class="top-text-box" v-if="check == 1">
				<view style="font-size: 36rpx;font-weight: 600;">洗衣结束等待拿取</view>
				<view style="padding-top: 15rpx;">请在{{detail.subscribe_time}}前到门店领取衣物</view>
			</view>
		</view>
		
		<view class="shop-title-box">
			<image style="width: 41rpx;height: 38rpx;margin-left: 30rpx;" src="https://syxiyi.oss-cn-shenzhen.aliyuncs.com/frontend/img/yyshop-logo.png"></image>
			<view style="padding-left: 10rpx;font-weight: 600;color: #323232;font-size: 32rpx;">
				{{ check == 1 ? detail.name : '请先登录'}}
			</view>
		</view>
		
		<view class="cont-box">
			<view class="cont-list">
				<view>订单详情:</view>
				<view>{{detail.title}}</view>
			</view>
			<view class="cont-list">
				<view>订单编号:</view>
				<view>{{detail.order_no}}</view>
			</view>
			<view class="cont-list">
				<view>下单时间:</view>
				<view>{{detail.create_at}}</view>
			</view>
		</view>
		
		<view class="but" @click="confirm" v-if="check == 1">确认已领取</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_id: '',
				detail: '',
				check:0
			}
		},
		onLoad(options) {
			let loginstatus = uni.getStorageSync('token');
			
			if(loginstatus)
			{
				this.check = 1
				this.order_id = options.id
				this.getDetail()
			}
		},
		methods: {
			getDetail() {
				this.$ajaxRequest.get(this.baseUrl + 'shop/order/Detail', {
					order_id: this.order_id
				}, true).then(res => {
					if (res.data.code == 200) {
						this.detail = res.data.data
					} else {
						uni.showToast({
							title:res.data.msg,
							icon: 'none'
						})
					}
				})
			},
			confirm() {
				this.$ajaxRequest.put(this.baseUrl + 'shop/order/confirm', {
					order_id: this.order_id
				}, false).then(res => {
					if (res.data.code == 200) {
						uni.showToast({
							title:res.data.msg,
							icon: 'none'
						})
						setTimeout(() => {
							uni.navigateBack({
								delta:1
							})
						}, 100)
					} else {
						uni.showToast({
							title:res.data.msg,
							icon: 'none'
						})
					}
				})
			}
			// again() {
			// 	uni.navigateTo({
			// 		url:'/pages/yuyue/index'
			// 	})
			// }
		}
	}
</script>

<style>
	.shop-title-box {
		display: flex;
		align-items: center;
		padding-top: 30rpx;
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid rgba(168, 168, 168, .2);
	}
	.top-box{
		position: relative;
		height: 220rpx;
	}
	.top-bg{
		width: 750rpx;
		height: 220rpx;
		position: absolute;
	}
	.top-text-box{
		padding-top: 66rpx;
		padding-left: 64rpx;
		position: relative;
		z-index: 1;
		color: white;
	}
	.cont-box {
		padding-top: 30rpx;
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid rgba(168, 168, 168, .2);
	}
	
	.cont-list {
		display: flex;
		/* align-items: center; */
		padding: 10rpx 30rpx 10rpx 30rpx;
		font-size: 30rpx;
		color: #A8A8A8;
	}
	
	.cont-list>view:last-of-type {
		max-width: 500rpx;
		padding-left: 20rpx;
		color: #323232;
		font-size: 30rpx;
	}
	.but {
		position: fixed;
		bottom: 30rpx;
		width: 690rpx;
		left: 30rpx;
		padding: 20rpx 0rpx 20rpx 0rpx;
		text-align: center;
		font-size: 30rpx;
		background: linear-gradient(-17deg, rgba(255, 114, 59, 1), rgba(255, 147, 67, 1));
		color: white;
		border-radius: 40rpx;
	}
</style>
